home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20031118-20041115 / 000401_fdc@columbia.edu_Wed Sep 22 13:33:01 2004.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Path: newsmaster.cc.columbia.edu!not-for-mail
  2. From: Frank da Cruz <fdc@columbia.edu>
  3. Newsgroups: comp.protocols.kermit.misc
  4. Subject: Re: Return codes and If statments
  5. Date: 22 Sep 2004 17:32:18 GMT
  6. Organization: Columbia University
  7. Lines: 55
  8. Message-ID: <slrncl3dp2.ftp.fdc@sesame.cc.columbia.edu>
  9. References: <3f9c05b0.0409211252.5aa51cb1@posting.google.com> <slrncl18i5.56s.fdc@sesame.cc.columbia.edu> <1095827419.338981.28270@k26g2000oda.googlegroups.com> <3f9c05b0.0409220853.25e5bd46@posting.google.com>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: sesame.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1095874338 3737 128.59.59.56 (22 Sep 2004 17:32:18 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 22 Sep 2004 17:32:18 GMT
  15. User-Agent: slrn/0.9.8.0 (SunOS)
  16. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:15179
  17.  
  18. On 2004-09-22, Peter V. <dm_v_2000@yahoo.com> wrote:
  19. :   thank you both for your advice.  I am sticking to recommended format
  20. : Number 2, and that seems to have done the trick.
  21. :
  22. I realize it might be a big counterintuitive for C programmers, but it
  23. should be recalled that Kermit differs from C not only in being interpretive
  24. rather than compiled, but also it's an interactive command language, and
  25. therefore necessarily line-oriented: each command is one line.  Thus the
  26. true format of a compound IF-ELSE statement is:
  27.  
  28.   if <condition> { command, command, ... } ELSE { command, command, ... }
  29.  
  30. Prior to C-Kermit 7.0, if you wanted to break such a statement onto multiple
  31. lines, you had to use line continuation:
  32.  
  33.   if <condition> { -
  34.       command, -
  35.       command, -
  36.       ... -
  37.   } ELSE {
  38.       command, -
  39.       command, -
  40.       ... -
  41.   }
  42.  
  43. Version 7.0 added several tricks to the parser to give more natural
  44. syntax: (a) If a line ENDS with "{" (ignoring whitespace) it is continued
  45. and begins a block; (b) if a line BEGINS with "}" (ignoring whitespace) it
  46. ends a block; (c) if a block is active, the end of each line implies a
  47. comma (which is used to separate statements within blocks).  Once a block
  48. is opened at top level, these tricks are used until the block is closed,
  49. and naturally, they persist through any level of nesting.  This explains
  50. why a construction like:
  51.  
  52.   IF <condition> {
  53.      command
  54.      command
  55.   }
  56.  
  57. works, but:
  58.  
  59.   IF <condition>
  60.   {
  61.      command
  62.      command
  63.   }
  64.  
  65. doesn't.  The first line is an incomplete command with no indication of
  66. continuation.  The documentation:
  67.  
  68.   http://www.columbia.edu/kermit/ckermit70.html#x7.20
  69.  
  70. does not list the latter form as a possibility.
  71.  
  72. - Frank